namespace YXShop.ExcelLite
{
    using System;
    using System.Collections;
    using System.IO;
    using System.Text;

    internal class ExcelLongStrings : BinaryWritable
    {
        public int CharsRemaining;
        public ArrayList Strings;

        public ExcelLongStrings()
        {
            this.Strings = new ArrayList();
        }

        public ExcelLongStrings(BinaryReader br, int remainingSize, int charsLeftFromPrevious)
        {
            this.Strings = new ArrayList();
            while (remainingSize != 0)
            {
                ExcelLongString str = new ExcelLongString(br, ref remainingSize, ref charsLeftFromPrevious);
                this.Strings.Add(str);
            }
            this.CharsRemaining = charsLeftFromPrevious;
        }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder("ExcelLongStrings(");
            for (int i = 0; i < this.Strings.Count; i++)
            {
                ExcelLongString str = (ExcelLongString) this.Strings[i];
                if (i > 0)
                {
                    builder.Append(",");
                }
                builder.Append(str.GetFormattedStr());
            }
            builder.Append(")");
            return builder.ToString();
        }

        public override void Write(BinaryWriter bw)
        {
            foreach (ExcelLongString str in this.Strings)
            {
                str.Write(bw);
            }
        }

        public override int Size
        {
            get
            {
                int num = 0;
                foreach (ExcelLongString str in this.Strings)
                {
                    num += str.Size;
                }
                return num;
            }
        }
    }
}

